<template>
	<view class="container">
		<view class="loginbox">
			<view class="login_logo">
				<image src="/static/images/logo.png"></image>
			</view>
			<view class="login_formbox mt50">
				<form> 
					<view class="passwordbox">
						<image v-if="isShow" @tap="changeInout" src="../../images/guanbi.png" style="height:32rpx;"></image>
						<input bindinput='watchPtext' type='number' maxlength="11" name="" v-model='phone' placeholder="请输入11位手机号"></input>
					</view>
					<button id="bigbtn" @tap="modalcnt">发送验证码注册</button>
				</form>
				<button id="bigbtn_null">新用户注册</button>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				isShow: false,
				// watchPtext:0,
				nocancel: false, //是否显示取消按钮
				pwd_val: '', //输入值
				phone: '',
			}
		},
		methods: {
			modalcnt: function() {
				if (!(/^1[3456789]\d{9}$/.test(this.phone))) {
					uni.showToast({
						title: '手机号码有误',
						duration: 2000,
						icon: 'none'
					});
					return false;
				}



				wx.showModal({
					title: '手机验证',
					content: '是否确认获取验证码？',
					success: (res) => {
					 
						if (res.confirm) {
							uni.navigateTo({
								url: '/pages/home/smscheck?phone=' + this.phone
							});
						} else if (res.cancel) {
							console.log('用户点击取消')
						}
					}
				})
			},

			// 密码框失去焦点时
			bindblur: function(e) {
				this.setData({
					pwd_val: e.detail.value,
				})
			},
			// 清空显示隐藏
			watchPtext: function(e) {
				let value = e.detail.value
				this.setData({
					isShow: true,
					pwd_val: parseInt(value)
				})
			},
			changeInout: function() {
				this.setData({
					isShow: false,
					pwd_val: '' //输入值sadsa
				})
			},

		}
	}
</script>

<style scoped>
	@import url("/common/common.css");
</style>
